/************************************************************************
 * 
 *  handle histogramming
 * 
 ************************************************************************/

#ifndef HistoManager_h
#define HistoManager_h 1

#include "G4UnitsTable.hh"
#include "globals.hh"

class HistoManager;

#include "MiniBallHistoGenerator.hh"
#include "MiniBallHistoManager.hh"
#include "MiniBallRootGenerator.hh"

#include "TROOT.h"
#include "TFile.h"
#include "TTree.h"

#include "Data.hh"
#include "SiHit.hh"

#include "Barrel.hh"
#include "Annular.hh"
#include "Germanium.hh"

class HistoManager : public MiniBallHistoManager
{
public:
  HistoManager(MiniBallRootGenerator* histGen, Data*);
  ~HistoManager();

public:
  void EndOfEvent();
  void FillFBBranch(Barrel*);
  void FillBBBranch(Barrel*);
  void FillFCDBranch(Annular*);
  void FillBCDBranch(Annular*);
  void FillMiniballBranch();
  void FillTree();
  void Clear();
  void Close();
  double GetEnergyUnit();
  void Status();

public:
  TTree* cl;

private:
  vector<Barrel>* fFBarrelBranch;
  vector<Barrel>* fBBarrelBranch;
  vector<Annular>* fFCDBranch;
  vector<Annular>* fBCDBranch;
  vector<Germanium>* fMiniball;
  long long fEbisTime;
  long long fT1Time;
  long long fSuperCycleTime;

  TTree* fdatatree;
  TTree* fsimtree;

  bool DataWritten;

  Data* data;
};

#endif

